{extend name="index/base" /}
{block name="content"}
<blockquote class="layui-elem-quote fhui-admin-main_hd">
    <h2>站点配置</h2>
</blockquote>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">

                <div class="layui-card-body">
                    <form class="layui-form layui-form-pane" action="">
                        <div class="layui-row layui-col-space10">
                            <div class="layui-col-md3">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">网址</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="site_url" lay-verify="required" autocomplete="off"
                                               placeholder="请输入网站网址" class="layui-input" value="{$site.site_url|default=''}">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-col-md3">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">加盟电话</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="join_phone" lay-verify="required" autocomplete="off"
                                               placeholder="请输入加盟电话" class="layui-input" value="{$site.join_phone|default=''}">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-col-md6">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">地图秘钥</label>
                                    <div class="layui-input-block">
                                        <input type="password" name="map_key" lay-verify="required" autocomplete="off"
                                               placeholder="请输入腾讯地图秘钥" class="layui-input" value="{$site.map_key|default=''}">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-row layui-col-space10">
                            
                            <div class="layui-col-md6">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">客服电话</label>
                                    <div class="layui-input-block">
                                        <input type="tel" name="contacts_phone" lay-verify="required" autocomplete="off"
                                               placeholder="请输入客服电话" class="layui-input" value="{$site.contacts_phone|default=''}">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-col-md6">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">客服微信</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="contacts_wx" lay-verify="required" autocomplete="off"
                                               placeholder="请输入客服微信 " class="layui-input"
                                               value="{$site.contacts_wx|default=''}">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-row layui-col-space10">
                            <div class="layui-col-md3">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">七牛ID</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="qiniu_accessKey" lay-verify="required"
                                               autocomplete="off" placeholder="请输入七牛APPID" class="layui-input"
                                               value="{$site.qiniu_accessKey|default=''}">
                                    </div>
                                </div>
                            </div>

                            <div class="layui-col-md3">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">七牛秘钥</label>
                                    <div class="layui-input-block">
                                        <input type="password" name="qiniu_secretKey" lay-verify="required"
                                               autocomplete="off" placeholder="请输入七牛秘钥" class="layui-input"
                                               value="{$site.qiniu_secretKey|default=''}">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-col-md3">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">七牛Bucket</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="qiniu_bucket" lay-verify="required" autocomplete="off"
                                               placeholder="请输入七牛bucket" class="layui-input"
                                               value="{$site.qiniu_bucket|default=''}">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-col-md3">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">七牛域名</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="qiniu_domain" lay-verify="required" autocomplete="off"
                                               placeholder="请输入七牛域名" class="layui-input"
                                               value="{$site.qiniu_domain|default=''}">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-row layui-col-space10">
                            <div class="layui-col-md3">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">短信APPID</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="sms_account" lay-verify="required" autocomplete="off"
                                               placeholder="请输入短信APPID" class="layui-input" value="{$site.sms_account}">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-col-md3">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">短信秘钥</label>
                                    <div class="layui-input-block">
                                        <input type="password" name="sms_password" lay-verify="required"
                                               autocomplete="off" placeholder="请输入短信秘钥" class="layui-input"
                                               value="{$site.sms_password}">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-col-md3">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">短息模板</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="sms_templet" lay-verify="required" autocomplete="off"
                                               placeholder="请输入模板ID" class="layui-input" value="{$site.sms_templet}">
                                    </div>
                                </div>
                            </div>

                            <div class="layui-col-md3">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">短信签名</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="sms_sign" lay-verify="required" autocomplete="off"
                                               placeholder="请输入短信签名" class="layui-input" value="{$site.sms_sign}">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-row layui-col-space10">
                            <div class="layui-col-md3">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">微信APPID</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="wx_appid" lay-verify="required" autocomplete="off"
                                               placeholder="请输入微信APPID" class="layui-input" value="{$site.wx_appid|default=''}">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-col-md3">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">微信秘钥</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="wx_screte" lay-verify="required" autocomplete="off"
                                               placeholder="请输入微信秘钥" class="layui-input" value="{$site.wx_screte|default=''}">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-col-md3">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">商户号</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="wx_mch_id" lay-verify="required"
                                               autocomplete="off" placeholder="请输入微信商户号" class="layui-input"
                                               value="{$site.wx_mch_id|default=''}">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-col-md3">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">商户秘钥</label>
                                    <div class="layui-input-block">
                                        <input type="password" name="wx_mch_key" lay-verify="required" autocomplete="off"
                                               placeholder="请输入微信商户秘钥" class="layui-input" value="{$site.wx_mch_key|default=''}">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-row layui-col-space10">
                            <div class="layui-col-md3">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">积分比</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="integration_percent" lay-verify="required" autocomplete="off"
                                               placeholder="请输入积分比" class="layui-input" max="1" value="{$site.integration_percent|default='1'}">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-col-md3">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">返利比</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="fanli_percent" lay-verify="required" autocomplete="off"
                                               placeholder="请输入返利比" class="layui-input" max="1" value="{$site.fanli_percent|default='1'}">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-col-md3">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">付款时限</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="pay_limit" lay-verify="required" autocomplete="off"
                                               placeholder="请输入付款时间,单位小时" class="layui-input" min="1" value="{$site.pay_limit|default='1'}">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-col-md3">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">自动收货</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="recieve_limit" lay-verify="required" autocomplete="off"
                                               placeholder="请输入自动收货时间，单位天" class="layui-input" min="1" value="{$site.recieve_limit|default='1'}">
                                    </div>
                                </div>
                            </div>
                            
                        </div>
                        <div class="layui-row layui-col-space10">
                            <div class="layui-col-md12">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">热搜</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="hot_keywords" lay-verify="required" autocomplete="off"
                                               placeholder="请输入热搜关键词 " class="layui-input"
                                               value="{$site.hot_keywords|default=''}">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-row layui-col-space10">
                            <div class="layui-col-md12">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">加盟来源</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="join_way" lay-verify="required" autocomplete="off"
                                               placeholder="请输入加盟来源配置项，多个以#分隔" class="layui-input" value="{$site.join_way|default=''}">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-row layui-col-space10">
                            <div class="layui-col-md6">
                                <div class="layui-form-item layui-form-text">
                                    <label class="layui-form-label">关于加盟</label>
                                    <div class="layui-input-block">
                                        <textarea name="about_join" id="about_join" lay-verify="" autocomplete="off" placeholder="请输入加盟简介" class="layui-textarea">{$site.about_join|default=""}</textarea>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-col-md6">
                                <div class="layui-form-item layui-form-text">
                                    <label class="layui-form-label">规则介绍</label>
                                    <div class="layui-input-block">
                                        <textarea name="rule_introduce" id="rule_introduce" lay-verify="" autocomplete="off" placeholder="请输入规则介绍" class="layui-textarea" style="min-height:325px;">{$site.rule_introduce|default=""}</textarea>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-row layui-col-space10">
                            <div class="layui-col-md6">
                                <div class="layui-form-item layui-form-text">
                                    <label class="layui-form-label">返利规则</label>
                                    <div class="layui-input-block">
                                        <textarea name="fanli_rule" id="rule_introduce" lay-verify="" autocomplete="off" placeholder="请输入规则介绍" class="layui-textarea" style="min-height:325px;">{$site.fanli_rule|default=""}</textarea>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!--<div class="layui-row layui-col-space10">-->

                        <!--<div class="layui-col-md3">-->
                        <!--<div class="layui-upload">-->
                        <!--<button type="button" class="layui-btn file-btn" id="logo">网站logo</button>-->
                        <!--<input type="hidden" name="site_logo" id="site_logo" value="{$site.site_logo|default=''}">-->
                        <!--<div class="layui-upload-list">-->
                        <!--<img class="layui-upload-img" id="site_logo_img" src="/uploads/site/{$site.site_logo|default=''}" onerror="this.src='/static/img/file.png'">-->
                        <!--<p id="demoText5_en"></p>-->
                        <!--</div>-->
                        <!--</div>-->
                        <!--</div>-->

                        <!--<div class="layui-col-md3">-->
                        <!--<div class="layui-upload">-->
                        <!--<button type="button" class="layui-btn file-btn" id="erweima">二维码</button>-->
                        <!--<input type="hidden" name="site_qrcode" id="site_qrcode" value="{$site.site_qrcode|default=''}">-->
                        <!--<div class="layui-upload-list">-->
                        <!--<img class="layui-upload-img" id="site_qrcode_img" src="/uploads/site/{$site.site_qrcode|default=''}" onerror="this.src='/static/img/file.png'">-->
                        <!--<p id="demoText5_en"></p>-->
                        <!--</div>-->
                        <!--</div>-->
                        <!--</div>-->
                        <!--</div>-->
                        <div class="layui-form-item" style="text-align: right;">
                            <button class="layui-btn" lay-submit="" lay-filter="*">保存</button>
                        </div>

                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{/block}
{block name="js"}
<script type="text/javascript">
    layui.use(['form', 'laydate', 'upload', 'layedit'], function () {
        var $ = layui.$
        upload = layui.upload;
        var token = layui.sessionData('token').token;
        var uploadInst = upload.render({
            elem: '.file-btn'
            , url: '{:url("tdmin/Common/imgUpload")}'
            , before: function (obj) {
                //预读本地文件示例，不支持ie8
                obj.preview((index, file, result) => {
                    // $('#uploadimg1').attr('src', result); //图片链接（base64）
                    $('#' + this.item.context.id).parent().find('img').attr('src', result);
                });
            }
            , done: function (r) {
                //如果上传失败
                if (r.code !== 200) {
                    return layer.msg(r.msg);
                } else {
                    layer.msg('上传成功');
                    // $("#site_logo").val(r.data);
                    $('#' + this.item.context.id).parent().find('input').attr('value', r.data);
                }
            }
            , error: function () {
                //演示失败状态，并实现重传
                var demoText = $('#' + this.item.context.id).parent().find('p');
                demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini demo-reload">重试</a>');
                demoText.find('.demo-reload').on('click', function () {
                    uploadInst.upload();
                });
            }
        });
        var layedit = layui.layedit;
        layedit.set({
            uploadImage: {
                url: '{:url("tdmin/Common/textImgUpload")}'
                , type: 'post'
            }
        });
        var index = layedit.build('about_join'); //建立编辑器
        layui.form.on('submit(*)', function (data) {
            data.field.about_join = layedit.getContent(index);//获取编辑器中的内容
            $.post('{:url("tdmin/Sysconfig/saveConfig")}?token='+token, data.field, function (res) {
                layer.msg(res.msg);
            });
            return false;
        });
    });
</script>
{/block}